<html>
	<head>
		<!-- Pull the engine from the Quintus CDN or load it locally -->
		<script src='http://cdn.html5quintus.com/v0.1.1/quintus-all.min.js'></script>
	</head>
	<body>
		<script>

			// Now set up your game (most games will load a separate .js file)
			var Q = Quintus()                          // Create a new engine instance
				.include("Sprites, Scenes, Input, 2D, Touch, UI") // Load any needed modules
				.setup({width: 800, height: 600})                           // Add a canvas element onto the page
				.controls()                        // Add in default controls (keyboard, buttons)
				.touch();                          // Add in touch support (for the UI)
			
			
			Q.Sprite.extend("Ball",{
				init:function(p) {
					this._super(p,{
						asset: "tileset.png",
						x: 0, 
						y: 0
					}); 
					this.bouzine = 100;
				},
				step: function(dt) {
					// this.p.vy += dt * 9.8;

					this.p.x += this.bouzine*dt;
					this.p.y += this.bouzine*dt;
					if (this.p.x < 0 || this.p.x > 800) this.bouzine = this.bouzine * (-1);
					if (this.p.y < 0 || this.p.y > 600) this.bouzine = this.bouzine * (-1);
				}
			});
			
			

			Q.load(["tileset.png"],function() {
				var ball = new Q.Ball();
				Q.gameLoop(function(dt) {
					ball.update(dt);
					my_text.update(dt);
					my_text.render(dt);
					Q.clear();
					ball.render(Q.ctx);
				});
				Q.touch(
					function(touchs) {
						alert('poil');
					}
				);
			});
		</script>
	</body>
</html>